package com.pubinfo.passbook.common.model.vo.base;

/**
 * 枚举了一些常用API操作码
 */
public enum BusinessErrorCode implements IErrorCode {

    PUB_ERROR(9000, "ERROR"),

    STATUS_NOT_EXIST(9001, "状态异常"),
    PARAM_ERROR(9002, "参数异常"),

    /**
     * 合同错误信息
     */
    CONTRACT_NOT_FUND(10001, "合同不存在"),
    CONTRACT_CANT_CLAIM(10002, "当前合同不可认领"),
    CONTRACT_CLOSED(10003, "当前合同已关闭"),
    
    /**
     * 成本信息错误
     */
    WBS_NOT_FUND(11001, "合同项目不存在"),
    WBS_LESS_ONE(11002, "请至少关联一个项目信息并填写截止目前合同的执行情况!"),
    
    /**
     * 发票信息错误
     */
    INVOICE_CANT_APPLY(12001, "合同暂不可开票"),
    INVOICE_AMOUNT_NOT_ENOUGH(12002, "合同可开票金额不足"),
    INVOICE_APPLY_NOT_FUND(12003, "合同开票申请不存在"),
    
    COMPENSATE_REMOVE_ERROR(13001, "合同结转失败"),

    ;

    public final Integer code;
    public String message;

    BusinessErrorCode(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public static BusinessErrorCode pubError(String msg) {
        BusinessErrorCode errorCode = BusinessErrorCode.PUB_ERROR;
        errorCode.message = msg;
        return errorCode;
    }

}
